#{extends 'main.html' /}
#{set title:'投诉详情' /}
<script type="text/javascript" src="/public/sui/js/lrz.all.bundle.js"></script>
<script type="text/javascript" src="/public/sui/js/uploadImg.js"></script>
<style>
    .complaint_list li{border-bottom: 0; border-top: 1px #eeeeee solid;}
</style>
<body>
<div class="page-group">
    <div class="page">
        <header class="bar bar-nav">
            <a href="javascript:history.go(-1);" class="icon icon-left pull-left"></a>
            <h1 class="title">产品详情</h1>
        </header>
        <section class="complaint content scroll_y" style="padding-bottom:2rem;" >

                <input id="reportId" type="hidden" name="reportId" value="${report?.id}">
                <div class="complaint_form">

                    #{if reportRemark?.reportImage!= null &&  reportRemark?.reportImage!= '' }
                        <ul class="complaint_pic">
                            <li id="addli" class="addbtn create-actions" >
                                <img src="${reportRemark.reportImage}" style="margin:0 auto">
                            </li>
                        </ul>
                    #{/if}
                   #{if reportRemark?.reportImage == null ||  reportRemark?.reportImage == '' }
                       <ul class="complaint_pic">
                           <li id="addli" class="addbtn create-actions" >
                              <p>暂无图片</p>
                           </li>
                       </ul>
                   #{/if}

                    <h3>投诉内容 </h3>
                    <textarea id="userRemarks" class="areabox"  readonly name="userRemarks"> ${reportRemark.reportRemarks}</textarea>
                    <h3>投诉产品</h3>
                    <ul class="complaint_list">
                        <li>
                             <img src="${report?.orderItem?.goods?.img}">
                             <h3>${report?.orderItem?.goods?.name} </h3>
                            <p>规格/数量：<span>${report?.orderItem?.goods?.spec != undefined ? report?.orderItem?.goods?.spec + '*': '*'}${report?.orderItem?.buyNumber}</span></p>
                            <p>单价：<span>${report?.orderItem?.salePrice} </span></p>
                            <p>总价：<span>${report?.orderItem?.amount} </span></p>
                        </li>
                    </ul>
                     <h3>商户申诉内容 </h3>
                     <textarea id="reportRemarks" class="areabox"   name="reportRemarks"></textarea>
                </div>
                <div class="content-block">
                    <input type="button" name="button" class="button button-fill button-big" id="button" onclick="savePro()" value="申诉">

                </div>
                <div class="content-block">
                    <input type="button" name="button" class="button button-fill button-big" id="button" onclick="savePro('SELLER_AGREES')" value="同意退款">
                </div>

        </section>

    #{include 'footer.html'/}
    </div>
</div>
<div id="img_tmp" style="display: none;">
    <li class="img">
        <a href="#"><i class="iconfont">&#xe6d3;</i></a>
        <img src="" id="img_src"/>
        <input type="hidden" class="imgs" id="img_src_hidden" value="imgSrc"/>
    </li>
</div>
<script>$.init()</script>
<script>

    function savePro(status){ //jquery获取复选框值
        var reportRemarks = $('#reportRemarks').val();
        var reportId = $('#reportId').val();
        var str = "申诉已提交"
        if(status != 'SELLER_AGREES'){
            if($.trim($('#reportRemarks').val())==""){
                $.toast('请填写投诉内容!!');
                return;
            }
        }else {
            str ='您已同意退款!';
        }
       $.getJSON('/report/saveReport',
                {reportId:reportId ,
                 reportRemarks:reportRemarks,
                 refundStatus:status
                },
                function (data) {
                    if(data.success){
                          $.toast(str);
                        window.location.href = "/report/index";
                    }else {
                        $.toast(data.msg);
                    }
           });

    }

</script>

</body>
